home *** CD-ROM | disk | FTP | other *** search
Wrap
AMOS Source Code | 1992-09-28 | 6.3 KB | 183 lines
'*************************** '* AMOS Professional * '* * '* AMAL_1 * Getting started with amal '* * '* (c) Europress Software * '* * '* Ronnie Simpson * '*************************** ' '------------------------------------------- 'AMAL (AMos Animation Language) '------------------------------------------- 'Amal is a separate language within Amos Professional which is optimised for 'speed, up to 16 Amal channels can be used at a time driven under interupts 'and these will be running independantly of your main program. 'Each Amal program is compiled before runtime to further increase the speed 'of execution. 'As a default channels 0-7 are allocated to the hardware sprites and 'channels 8-15 to the relevant computed sprites, but commands are included 'to allow channels to be assigned to other tasks such as:- ' ' Blitter objects (bobs) ' Screen Display ' Screen Offset ' Screen Size ' Rainbows ' '------------------------------------------- 'Creating a simple Amal Program '------------------------------------------- 'Amal programs are defined in a string using short keywords consisting of 'only one or two letters in upper case, anything typed in lower case will 'be ignored, this allows you to pad out the instructions to make things 'more readable for example:- ' ' A$="M50,50,100" may be typed as A$="Move 50,50,100" ' 'Amal channels are assigned to the strings by use of the Amal instruction. ' 'eg. Amal 1,A$ ' 'And the animation is started by use of the Amal On instruction, if an 'optional channel number is included then only this channel is started 'otherwise it will start all channels that have a program assigned to them. ' 'eg. Amal On 2 (start only channel number 2) ' Amal On (start all amal channels) ' 'Since lower case letters are ignored Amal instructions may be separated by 'any unused characters including spaces but to avoid headaches and increase 'readability try using the ; character. ' 'Please note that the : (colon) is reserved for defining a label in Amal. ' '------------------------------------------- 'The Amal Move Instruction '------------------------------------------- 'Keyword M ' ' +--->total horizontal movement ' | +--->total vertical movement ' | | +--->number of steps ' M 100,100,50 ' ' 'If the above, instruction was controlling a sprite or bob whose starting 'coordinate was 100,100 then the object would be progressively moved to '200,200 in 50 steps. 'If the horizontal movement is positive then the object will be moved to 'the right, if negative it will be moved to the left. 'If the Vertical movement is positive then the object will be moved down, 'if negative it will be moved upwards. 'The lower the number of steps the faster the movement appears. ' '------------------------------------------- 'Amal Jump instruction '------------------------------------------- 'Keyword J ' 'Labels are defined in amal by placing a : (colon) after any single upper- 'case letter, these labels then become the target for your Jump instructions. ' 'eg. A$="L: Move 100,0,100; Move -100,0,100; Jump L" ' 'The above example would move your object 100 units to the right followed by '100 units to the left and the jump instruction returns control to the label 'L: resulting in both move instructions being continually repeated. ' 'As with all other amal commands the label name can be padded out with lower 'case characters, the L: may be typed in as Label: for example. '------------------------------------------- 'Amal Anim instruction '------------------------------------------- 'Keyword A ' 'The amal Anim instruction will cycle an object through a sequence either 'continually or a given number of times. ' ' +--->number of times to be repeated ' | +--->image number ' | | +--->delay in 1/50ths. of a second ' | | | +--->next step of sequence ' A 1,(1,2)(2,2)....(3,2) ' 'If 0 is inserted for the number of times parameter then the sequence will 'be repeated continually. 'The image number is an image from the sprite bank. 'The delay is the amount of time the image will be displayed before the next 'image from the sequence is used. ' '------------------------------------------- 'A simple Amal program '------------------------------------------- 'Please examine this listing and try to understand the way in which an 'amal string is put together using only the instructions introduced so far. ' ' Rem *** load some objects to work with and clear the screen ' Load "AmosPro_Tutorial:Objects/Amal_Bobs.abk" Screen Open 0,320,200,16,Lowres : Flash Off Get Sprite Palette : Curs Off : Cls 0 ' Rem *** hide the mouse pointer to release sprite 0 ' Hide ' Rem *** the Amal string definition ' Rem *** starting with the Anim ' A1$="Anim 0,(1,4)(2,4)(3,4)(4,4)" ' Rem *** now we need a label to Jump to ' A2$="Label:" ' Rem *** add 4 move instructions ' A3$="Move -400,0,100;Move 0,-80,5;Move 400,0,5;Move 0,80,5" ' Rem *** the Jump instruction will continually repeat the above moves ' A4$="Jump Label" ' Rem *** now join all the above to form the complete amal string ' A$=A1$+A2$+A3$+A4$ ' '------------------------------------------------------------------------- Rem *** full string with padding letters removed would look like this:- ' ' Amal 0,"A0,(1,4)(2,4)(3,4)(4,4)L: M-400,0,100M0,-80,5M400,0,5M0,80,5JL" ' '------------------------------------------------------------------------- ' Rem *** assign an amal channel to the string ' Amal 0,A$ ' Rem *** set start position of the sprite off right hand edge of screen ' Sprite 0,500,100,4 ' Rem *** and finally start the amal program ' Amal On ' ' T$="The bird is now moving independent of the main program. If you do not believe me then press any mouse key to stop the main program and return to direct mode .....but..... watch the BIRDIE!!!!" Paper 0 : C=4 Repeat Locate 0,13 : Pen C For P=1 To Len(T$) Print Mid$(T$,P,1); : Wait 2 If Mouse Key Then Exit 2 Next Add C,2,4 To 6 Until Mouse Key Locate 0,13 : Print T$ Pen 4 : Locate 0,5 : Centre "See what I mean?" Direct